#include <iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
void practice_3_12();
void example_p87();
void example_p89();
void example_p91();
void practice_3_14();
void practice_3_15();
void practice_3_16();
void practice_3_17();
void practice_3_20_a();
void practice_3_20_b();
int main()
{
	example_p91();
	//practice_3_16();
	//practice_3_17();
	//practice_3_20_a();
	//practice_3_20_b();
	//example_p87();
	//example_p89();
	return 0;
}
void practice_3_12()
{
	vector<vector<int>> ivec;
	//vector<string> svec=ivec;
	vector<string> v6{10}; 
}
void example_p87()
{
	//vector <int&> v;
	int i1=5,i2=7;
	int &r1=i1,&r2=i2;
	vector<int> v1;
	v1.push_back(r1);v1.push_back(r2);
	for(auto c:v1)cout<<c<<" ";
}
void example_p89()
{
	int a=4,b=5;
	vector<int> v{a,b};
	for(auto c:v)cout<<c<<" ";
}
void example_p91()
{
	vector<int> v={1,2,3,4,6,8,10};
	for(auto c:v){
		cout<<c<<endl;
		v.push_back(9);
		//打印输出之后是乱的
	}
}
void practice_3_14()
{
	int item;
	vector<int> v;
	while(cin>>item)
		v.push_back(item);
}
void practice_3_15()
{
	string item;
	vector<string> v;
	while(cin>>item)
		v.push_back(item);
}
void practice_3_16()
{
	void vec_printer(vector<int> v,int index);
	void vec_printer(vector<string> v,int index);
	vector<int> v1;
	vec_printer(v1,1);
	vector<int> v2(10);
	vec_printer(v2,2);
	vector<int> v3(10,42);
	vec_printer(v3,3);
	vector<int> v4{10};
	vec_printer(v4,4);
	vector<int> v5{10,42};
	vec_printer(v5,5);
	vector<string> v6{10};
	vec_printer(v6,6);
	vector<string> v7{10,"hi"};
	vec_printer(v7,7);

}
void vec_printer(vector<int> v,int index)
{
	cout<<"v"<<index<<":"<<v.size()<<endl;
	for(auto c:v)
		cout<<c<<" ";
	cout<<endl;
}

void vec_printer(vector<string> v,int index)
{
	cout<<"v"<<index<<":"<<v.size()<<endl;
	for(auto c:v)
		cout<<c<<" ";
	cout<<endl;
}

void practice_3_17()
{
	string word;
	vector<string> v;
	while(cin>>word)
		v.push_back(word);
	for(auto &str:v)
		for(auto &c:str)
			c=toupper(c);
	for(auto str:v)
		cout<<str<<endl;
}
void practice_3_20_a()
{
	int item;
	vector<int> v;
	while(cin>>item)
		v.push_back(item);
	cout<<"before: "<<endl;
	for(auto c:v)
		cout<<c<<" ";
	cout<<endl;
	cout<<"after:"<<endl;
	for(vector<int>::size_type i=0;i<v.size();i+=2)
	{
		if((i+1)<v.size())
			cout<<v[i]+v[i+1]<<" ";
		else
			cout<<v[i]<<" ";
	}
	cout<<endl;
}
void practice_3_20_b()
{
	int item;
	vector<int> v;
	while(cin>>item)
		v.push_back(item);
	cout<<"before: "<<endl;
	for(auto c:v)
		cout<<c<<" ";
	cout<<endl;
	cout<<"after:"<<endl;
	for(vector<int>::size_type i=0;i<v.size()/2;++i)
		cout<<v[i]+v[v.size()-i-1]<<" ";
	if((v.size()%2)!=0)
		cout<<v[v.size()/2]<<" ";
	cout<<endl;
}